extends Talent
var utils = globalData.infoDs["g_AneHekUtils"]
var base = globalData.infoDs["g_AneHekBase"]
func init():
	name = "理财专家[通用]"
var flag = 1
var cha = null
var cnt = 0
var cntlimt = 40
func _connect():
	cnt = 0
	sys.main.connect("onBattleStart", self, "run")
	sys.main.connect("onBattleEnd",self,"changeflag")

func run():
	cnt += 1
	print("当前战斗次数：",cnt)
func changeflag():
	if cnt  % 5 == 0:
		if sys.rndPer(2):
			var gold = sys.main.player.gold * 0.2
			sys.main.player.plusGold(-gold)
			if sys.main.player.gold < 0:
				sys.main.player.gold = 0
				sys.main.player.plusGold(0)
			print("理财失败,损失金币：",gold)
			return
		var gold = sys.main.player.gold * 0.1
		sys.main.player.plusGold(gold)
		print("理财成功，获得金币：",gold)
func get_info():
	return "每5场战斗，获得当前金币10%的金币[有2%概率失败]\n此天赋不需要升级"